package com.haoxiaozi.www.GUIFunctionStudy;

import java.awt.*;
import java.awt.BorderLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 34255
 * Date: 2024-12-07
 * Time: 16:29
 */
public class FluidLayoutDemo {
    public static void main(String[] args) {
        Frame frame = new Frame("hao-xiao-zi");

        frame.setVisible(true);

        frame.setBounds(300,300,500,500);

        frame.setBackground(new Color(185, 125, 125));

        //组件-按键
        Button east = new Button("east");
        Button west = new Button("west");
        Button south = new Button("south");
        Button north = new Button("north");
        Button center = new Button("center");

        //添加按键
        frame.add(east,BorderLayout.EAST);
        frame.add(west,BorderLayout.WEST);
        frame.add(south,BorderLayout.SOUTH);
        frame.add(north,BorderLayout.NORTH);
        frame.add(center,BorderLayout.CENTER);



        frame.addWindowListener(new WindowAdapter(){
            @Override
            public void windowClosing(WindowEvent e) {
                //结束程序
                System.exit(0);
            }
        });
    }
}
